﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    Codebehind="ApplyVerify.aspx.cs" Inherits="Ankin.EHBH.Web.Modules.Apply.ApplyVerify"
    Title="医用耗材管理系统" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphcenter" runat="server">

    <script src="../../js/jquery-1.3.2.min.js" type="text/javascript"></script>

    <script src="../../js/jquery.flexselect.js" type="text/javascript"></script>

    <script src="../../js/liquidmetal.js" type="text/javascript"></script>

    <script src="../../js/popupApply.js" type="text/javascript"></script>

    <script language="javascript" type="text/javascript">
<!--
    function judgeUserInput() {
        var patrn = /^[0-9]{1,20}$/;
        if (!patrn.exec(document.getElementById("<%=txtApproveQty.ClientID %>").value)) {
            alert("请输入数字");
            document.getElementById("<%=txtApproveQty.ClientID %>").focus();
            document.getElementById("<%=txtApproveQty.ClientID %>").select();
            return false;
        }
        else if(parseFloat(document.getElementById("<%=txtNowSock.ClientID %>").value)<parseFloat(document.getElementById("<%=txtApproveQty.ClientID %>").value))
        {
            if (!confirm('库存数量少于审核数量，继续吗？'))
                return false;
            else 
                return true;
        }
        else
            return true;
  }
  function judgeStackQty(){
     var inputs = document.getElementById("<%=gvDetail.ClientID%>").getElementsByTagName("input");
        for(var i=0; i <inputs.length; i++)
        {
            if(inputs[i].type=="checkbox" && inputs[i].checked==true)
            {
                if(parseFloat($($(inputs[i+1]).parent().prevAll().get(1)).text())<parseFloat(inputs[i+1].value))
                 { if (!confirm('库存数量少于审核数量，继续吗？'))
                     return false;
                   else 
                     return true;
                 }   
               // alert(inputs[i].value);    //这是CheckBox的value值，根据你的情况进行验证 
                //.
            }
        }
  
  }
  function ChooseColCheckBox(form,strCheckBoxID,blnMode)
    { 
	    var elss = form.elements;
    	
	    for (var i = 0 ; i < elss.length ; i ++)
	    {
		    var e = form.elements[i];
		    if (e.type == "checkbox")
		    {
			    if (e.id.substring(e.id.indexOf(strCheckBoxID),e.id.length) == strCheckBoxID)
			    {
				    if (e.disabled == false)
				    {
					    if (blnMode)
					    {
						    e.checked = true;
					    }
					    else
					    {
						    e.checked = false;
					    }
				    }
			    }
		    }
	    }
    }
    function btnSelectAll_onclick() 
    {
        var inputs = document.getElementById("<%=gvDetail.ClientID%>").getElementsByTagName("input");
        
        for(var i=0; i <inputs.length; i++)
        {
            //alert(inputs[i].type);
            if(inputs[i].type=="checkbox")
            {
             inputs[i].checked=true;
             //   inputs[i].value    //这是CheckBox的value值，根据你的情况进行验证 
                //.
            }
        }
    }
    function btnCancel_onclick()
    {
        var inputs = document.getElementById("<%=gvDetail.ClientID%>").getElementsByTagName("input");
        for(var i=0; i <inputs.length; i++)
        {
            //alert(inputs[i].type);
            if(inputs[i].type=="checkbox")
            {
             inputs[i].checked=false;
             //   inputs[i].value    //这是CheckBox的value值，根据你的情况进行验证 
                //.
            }
        }
    }
// -->
</script>

    <table width="630" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td class="right-color">网上请领-请领审核</td>
        </tr>
        </table>
     <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-top:15px;">
        <tr>
            <td>
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                    <td class="bor-bg bor">申请单信息</td>
                    </tr>
                    <tr>
                    <td class="bor">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="t1">  
                    <tr>
                        <td width="16%" align="right" style="height: 22px">
                            申请单号：</td>
                        <td width="17%" nowrap="nowrap" style="height: 22px"><asp:Label ID="lblBillID" runat="server"></asp:Label></td>
                        <td width="16%" align="right" style="height: 22px">
                            申请日期：</td>
                        <td width="15%" style="height: 22px"><asp:Label ID="lblApplyDate" runat="server"></asp:Label></td>
                        <td style="width: 119px; height: 22px;" align="right">
                            申请人：</td>
                        <td width="9%" style="height: 22px"><asp:Label ID="lblApplier" runat="server"></asp:Label></td>
                    </tr>
                    <tr>
                        <td align="right">
                            申请部门：</td>
                        <td><asp:Label ID="lblApplyDept" runat="server"></asp:Label></td>
                        <td align="right">
                            申请类型：</td>
                        <td><asp:Label ID="lblApplyType" runat="server"></asp:Label></td>
                        <td style="width: 119px" align="right"></td>
                        <td></td>
                    </tr>
                        <tr>
                            <td align="right">
                                备注：</td>
                            <td colspan="2">
                                <asp:TextBox ID="txtMemo" runat="server" TextMode="MultiLine" Width="97%"></asp:TextBox></td>
                            <td align="right">
                                审核批注：</td>
                            <td align="right" colspan="2">
                            <asp:TextBox ID="txtAppMemo" runat="server" TextMode="MultiLine" Width="97%"></asp:TextBox>
                            </td>
                        </tr>
                    <tr>
                        <td align="right"></td>
                        <td colspan="5"></td>
                    </tr>
                </table>
                    </td>
                    </tr>
                 </table> 
            </td>
        </tr>
        <tr>
            <td style="padding-top:14px;">
                <table width="100%" cellspacing="0" cellpadding="0" border="0">
                    <tr><td class="bor bor-bg">
                    产品列表
                    </td></tr>
                    <tr>
                        <td style="padding:13px;" class="bor">
                            <asp:GridView ID="gvDetail" runat="server" Width="100%" AutoGenerateColumns="False" DataKeyNames="book_id" EmptyDataText="暂没有数据" OnRowCommand="gvDetail_RowCommand" OnRowDataBound="gvDetail_RowDataBound">
                                <Columns>
                                 <%--<asp:TemplateField>
                                        <FooterTemplate>
                                                                                
                                                <asp:Button ID="btnpassMain" runat="server" Text="通过"  CommandName="applyMain"   CssClass="button" Width="57" Height="25" style="cursor:pointer;"  />
                                                <asp:Button ID="btnHodeMain" runat="server" Text="待定"  CommandName="hodeMain"  CssClass="button" Width="57" Height="25" style="cursor:pointer;"  />
                                                <asp:Button ID="btnRejectMain" runat="server" Text="拒绝" CommandName="rejectMain"  CssClass="button" Width="57" Height="25" style="cursor:pointer;" />
                                    </FooterTemplate>
                                    </asp:TemplateField>--%>
                                <asp:TemplateField HeaderText="▼">
                                    <HeaderStyle Wrap="False" HorizontalAlign="Center" Width="1%" />
                                    <ItemStyle Wrap="False" HorizontalAlign="Center"></ItemStyle>
                                        <HeaderTemplate>
                                            <asp:CheckBox id="chkHeaderSelect" runat="server"></asp:CheckBox>
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:CheckBox ID="chkSelect" runat="server" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField Visible="False" DataField="book_id" FooterText="流水号" HeaderText="流水号"
                                        SortExpression="BOOK_ID">
                                        <HeaderStyle Wrap="False" HorizontalAlign="Center" Font-Bold="False" Font-Size="9pt">
                                        </HeaderStyle>
                                        <ItemStyle HorizontalAlign="Right"></ItemStyle>
                                    </asp:BoundField>
                                    <asp:BoundField Visible="False" DataField="bill_id" FooterText="单据号" HeaderText="单据号"
                                        SortExpression="bill_id">
                                        <HeaderStyle Wrap="False" HorizontalAlign="Center" Font-Bold="False" Font-Size="9pt">
                                        </HeaderStyle>
                                        <ItemStyle HorizontalAlign="Right"></ItemStyle>
                                    </asp:BoundField>
                                    <asp:BoundField DataField="book_id" HeaderText="编号" />
                                    <asp:BoundField DataField="class_name" HeaderText="产品分类" >
                                        <HeaderStyle Width="13%" />
                                    </asp:BoundField>
                                    
                                    <asp:BoundField DataField="exp_name" HeaderText="产品名称" />
                                    <asp:BoundField DataField="specs" HeaderText="规格型号" />
                                    <asp:BoundField DataField="unit" HeaderText="单位" />
                                    <asp:BoundField DataField="currentStock" HeaderText="现有数量" />
                                    <asp:BoundField DataField="quantity" HeaderText="申请数量" />
                                    <asp:TemplateField HeaderText="审核数量">
                                    <HeaderStyle Wrap="False" HorizontalAlign="Center" Width="10%" />
                                    <ItemStyle Wrap="False"  HorizontalAlign="Center"></ItemStyle>
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtInputQty" Text='<%# Eval("quantity") %>' onkeypress="if ((event.keyCode < 48 && event.keyCode!=46) || event.keyCode >57) event.returnValue = false;"
                                             style="text-align:right" Width="90%" runat="server"></asp:TextBox>
                                    </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="STATUS" HeaderText="审核结果" />
                                    <asp:TemplateField  HeaderText="审核">
                                        <ItemTemplate>
                                        <table width="57" border="0" cellspacing="0" cellpadding="0" align="center">
              <tr>
                <td height="25" align="center" class="button" style="padding-top:2px;">
                                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" CommandName="Apply" CommandArgument='<%# Eval("book_id") %>'
                                                Text="审核"></asp:LinkButton>
                                                </td></tr></table>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                   
                                </Columns>
                                 <PagerStyle CssClass="fy" />
                              <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                              <HeaderStyle  CssClass="gv-head" />
                              <EditRowStyle BackColor="#2461BF" />
                              <AlternatingRowStyle BackColor="White" />
                            </asp:GridView>
                    <table border="0" cellpadding="0" cellspacing="0" width="100%" style="margin-top:20px; margin-bottom:8px;" align="center">
                    <tr>
                        <td align="left">
                            <asp:Button ID="btnpassMain" runat="server" Text="通过" OnClientClick="return judgeStackQty();"  CssClass="button" Width="57" Height="25" style="cursor:pointer;" OnClick="btnpassMain_Click" />
                            <asp:Button ID="btnRejectMain" runat="server" Text="拒绝"  CssClass="button" Width="57" Height="25" style="cursor:pointer;" OnClick="btnRejectMain_Click" />
                            <asp:Button ID="btnHodeMain" runat="server" Text="待定"  CssClass="button" Width="57" Height="25" style="cursor:pointer;" OnClick="btnHodeMain_Click"  />                            <asp:Button ID="btnAdd" runat="server" Text="增加"  CssClass="button" Width="57" Height="25" style="cursor:pointer;" OnClick="btnAdd_Click"  />
                        </td>
                    </tr>
                    <tr>
                        <td align="center">&nbsp;&nbsp;
                            <asp:Button ID="btnVerify" runat="server" Text="提交审核" OnClick="btnVerify_Click" CssClass="longbutton" width="90" height="25" style="cursor:pointer;" />
                            <asp:Button ID="btnCancel" runat="server" Text="取消"  OnClick="btnCancel_Click" CssClass="longbutton" width="90" height="25" style="cursor:pointer;" />&nbsp;</td>
                    </tr>
                    </table>   
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        
    </table>
    <div id="popupContact">
        <a id="popupContactClose">x</a>
        <br />
        <table width="700" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td class="bor-bg bor">
                    请领审核</td>
            </tr>
            <tr>
            <td class="bor">
            <table width="700" border="0" cellpadding="0" cellspacing="0" class="t1 bor">
            <tr>
                <td width="80" align="right">
                    一级分类</td>
                <td >
                    &nbsp;<asp:Label ID="lblFirstClass" runat="server" Text="Label"></asp:Label></td>
                <td width="80" align="right">
                    二级分类
                </td>
                <td >
                    &nbsp;<asp:Label ID="lblSecClass" runat="server" Text="Label"></asp:Label></td>
                <td width="80" align="right">
                    产地</td>
                <td >
                    &nbsp;<asp:Label ID="lblOrigin" runat="server" Text="Label"></asp:Label></td>
            </tr>
            <tr>
                <td align="right">
                    产品名称</td>
                <td colspan="3">
                    &nbsp;<asp:Label ID="lblProductName" runat="server"></asp:Label></td>
                <td align="right">
                    规格型号</td>
                <td>
                    &nbsp;<asp:Label ID="lblSpec" runat="server" Text="Label"></asp:Label></td>
            </tr>
            <tr>
                <td align="right">
                    申请数量</td>
                <td>
                    &nbsp;<asp:Label ID="lblApplyQty" runat="server"></asp:Label></td>
                <td align="right">
                    审核数量</td>
                <td>
                    &nbsp;<asp:TextBox ID="txtApproveQty" runat="server"></asp:TextBox></td>
                <td align="right">
                    单位</td>
                <td>
                    &nbsp;<asp:Label ID="lblUnit" runat="server" Text="Label"></asp:Label></td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td style="width: 162px">
                    &nbsp;</td>
                <td style="width: 67px">
                    &nbsp;</td>
                <td style="width: 162px">
                    &nbsp;</td>
                <td style="width: 75px">
                    &nbsp;</td>
                <td style="width: 5px">
                    &nbsp;</td>
            </tr>
            <tr>
                <td align="right">
                    基本信息号</td>
                <td style="width: 162px">
                    <asp:TextBox ID="txtInfo_Id" runat="server" ReadOnly="true" BackColor="LightGray"></asp:TextBox></td>
                <td style="width: 67px" align="right">
                    消耗品代码</td>
                <td style="width: 162px">
                    <asp:TextBox ID="txtExp_Code" runat="server" BackColor="LightGray"></asp:TextBox></td>
                <td style="width: 75px" align="right">
                    分类代码</td>
                <td style="width: 5px">
                    <asp:TextBox ID="txtExp_Name_Class" runat="server" ReadOnly="true" BackColor="LightGray"></asp:TextBox></td>
            </tr>
            <tr>
                <td align="right">
                    产品名称</td>
                <td style=" width: 162px;">
                    <asp:TextBox ID="txtExp_Name2" runat="server" ReadOnly="true" BackColor="LightGray"></asp:TextBox></td>
                <td style="width: 67px;" align="right">
                    规格型号</td>
                <td>
                    <asp:TextBox ID="txtSpecs" runat="server" BackColor="LightGray"></asp:TextBox>
                   </td>
                <td style="width: 75px;" align="right">
                    规格缩写</td>
                <td>
                    <asp:TextBox ID="txtSpecs_Abbr" runat="server" ReadOnly="true" BackColor="LightGray"></asp:TextBox></td>
            </tr>
            <tr>
                <td align="right">
                    生产厂家</td>
                <td style="width: 162px;">
                    <asp:TextBox ID="txtFactory" runat="server" ReadOnly="true" BackColor="LightGray"></asp:TextBox></td>
                <td style="width: 67px;" align="right">
                    产地</td>
                <td style="width: 162px;">
                    <asp:TextBox ID="txtFcountry" runat="server" ReadOnly="true" BackColor="LightGray"></asp:TextBox></td>
                <td style="width: 75px;" align="right">
                    国别</td>
                <td style="width: 5px;">
                    <asp:TextBox ID="txtExp_Country" runat="server" ReadOnly="true" BackColor="LightGray"></asp:TextBox></td>
            </tr>
            <tr>
                <td align="right">
                    库存单位</td>
                <td style="width: 162px">
                    <asp:TextBox ID="txtUnits" runat="server" ReadOnly="true" BackColor="LightGray"></asp:TextBox>&nbsp;</td>
                <td style="width: 67px" align="right">
                    参考批发价</td>
                <td style="width: 162px">
                    <asp:TextBox ID="txtTrade_Pric" runat="server" ReadOnly="true" BackColor="LightGray"></asp:TextBox></td>
                <td style="width: 75px" align="right">
                    参考零售价</td>
                <td style="width: 5px">
                    <asp:TextBox ID="txtRetail_Pric" runat="server" ReadOnly="true" BackColor="LightGray"></asp:TextBox>&nbsp;</td>
            </tr>
            <tr>
                <td align="right">
                    现有库存</td>
                <td style=" width: 162px;">
                    <asp:TextBox ID="txtNowSock" runat="server" ReadOnly="true" BackColor="LightGray"></asp:TextBox></td>
                <td style="width: 67px;" align="right">
                    库存上限</td>
                <td style="width: 162px;">
                    <asp:TextBox ID="txtUp_Lim" runat="server" ReadOnly="true" BackColor="LightGray"></asp:TextBox></td>
                <td style="width: 75px;" align="right">
                    库存下限</td>
                <td style="width: 5px; height: 25px;">
                    <asp:TextBox ID="txtLow_Lim" runat="server" ReadOnly="true" BackColor="LightGray"></asp:TextBox></td>
            </tr>            
            <tr>
            <td align="center" colspan="6" style="padding:10px 0px 10px 0px;">
           <asp:HiddenField ID="hfdConfirm" runat="server" />
            <asp:Button ID="btnSaveToDt" runat="server" Text="通过" OnClientClick="return judgeUserInput();" OnClick="btnSaveToDt_Click" CssClass="button" Width="57" Height="25" style="cursor:pointer;" />
             <asp:Button ID="btnHode" runat="server" Text="待定"  CssClass="button" Width="57" Height="25" style="cursor:pointer;" OnClick="btnHode_Click" />
             <asp:Button ID="btnClosePop" runat="server" Text="拒绝"  CssClass="button" Width="57" Height="25" style="cursor:pointer;" OnClick="btnClosePop_Click" />
            <%--<input name="" id="btnClosePop" type="button" value="拒绝" class="button"  style="cursor:pointer;" />--%>
                      <asp:Label ID="lblVaild" runat="server" ForeColor="Red"></asp:Label>

            </td>
            </tr>
            
        </table>
            </td>
            </tr>
            </table>
         
        
        
    </div>
    
    <%--添加明细弹出窗体 --%>
    
    <div id="backgroundPopup">
    </div>
</asp:Content>
